package com.yunao.commons.metasearch.entity;


import com.yunao.commons.metasearch.common.Convert;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class CatchResult implements Comparator<CatchResult> {
    private int id; // 序号，用于排序和导出
    private String name; // 名称，例：微博名称，新闻网站名称等

    private String title; // 标题
    private String summary; // 摘要或微博正文
    private String href; // 网址
    private String source; // 来源

    private String pubdate; // 发布时间
    private long q; // 发布时间 (long)

    private String author; // 作者
    private String avatar; // 作者头像
    private String links; // 链接

    private String info; // 信息
    private String media; // 媒体信息
    private String img; // 只有一张图片
    private List<String> imgs; // 多张图片
    private String vdpic; // 视频图片
    private String video; // 视频链接

    private String more; // 更多消息
    private String expand; // 扩展
    private String reply; // 回复量
    private String repeat; // 转载数
    private String view; // 浏览量

    private CatchResult rer; // 转载

    public CatchResult() {
        imgs = new ArrayList<String>();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getPubdate() {
        return pubdate;
    }

    public void setPubdate(String pubdate) {
        this.pubdate = pubdate;
    }

    public long getQ() {
        return q;
    }

    public void setQ(long q) {
        this.q = q;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getLinks() {
        return links;
    }

    public void setLinks(String links) {
        this.links = links;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getMedia() {
        return media;
    }

    public void setMedia(String media) {
        this.media = media;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public List<String> getImgs() {
        return imgs;
    }

    public void setImgs(List<String> imgs) {
        this.imgs = imgs;
    }

    public String getVdpic() {
        return vdpic;
    }

    public void setVdpic(String vdpic) {
        this.vdpic = vdpic;
    }

    public String getVideo() {
        return video;
    }

    public void setVideo(String video) {
        this.video = video;
    }

    public String getMore() {
        return more;
    }

    public void setMore(String more) {
        this.more = more;
    }

    public String getExpand() {
        return expand;
    }

    public void setExpand(String expand) {
        this.expand = expand;
    }

    public String getReply() {
        return reply;
    }

    public void setReply(String reply) {
        this.reply = reply;
    }

    public String getRepeat() {
        return repeat;
    }

    public void setRepeat(String repeat) {
        this.repeat = repeat;
    }

    public String getView() {
        return view;
    }

    public void setView(String view) {
        this.view = view;
    }

    public CatchResult getRer() {
        return rer;
    }

    public void setRer(CatchResult rer) {
        this.rer = rer;
    }

    @Override
    public String toString() {
        return "CatchResult{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", title='" + title + '\'' +
                ", summary='" + summary + '\'' +
                ", href='" + href + '\'' +
                ", source='" + source + '\'' +
                ", pubdate='" + pubdate + '\'' +
                ", q=" + q +
                ", author='" + author + '\'' +
                ", avatar='" + avatar + '\'' +
                ", links='" + links + '\'' +
                ", info='" + info + '\'' +
                ", media='" + media + '\'' +
                ", img='" + img + '\'' +
                ", imgs=" + imgs +
                ", vdpic='" + vdpic + '\'' +
                ", video='" + video + '\'' +
                ", more='" + more + '\'' +
                ", expand='" + expand + '\'' +
                ", reply='" + reply + '\'' +
                ", repeat='" + repeat + '\'' +
                ", view='" + view + '\'' +
                ", rer=" + rer +
                '}';
    }
    public int compare(CatchResult o1, CatchResult o2) {
        int fun1 = Convert.getInt(o1.getRepeat()) + Convert.getInt(o1.getReply());
        int fun2 = Convert.getInt(o2.getRepeat()) + Convert.getInt(o2.getReply());
        return -1 * (fun1 - fun2);
    }
}
